#include <stdio.h>
#include <stdlib.h>

int main()
{
   char str[30] = "0x01234567";
   char *ptr;
   long ret;

   ret = strtol(str, &ptr, 0);
   printf("hex is  %lx\r\n", ret);
    printf("num is  %ld\r\n", ret);
   return(0);
}